package com.coffee.sku.api.sku.result;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
public class PeriodizationRegionalSkuResult implements Serializable {
    private Integer id;
    private Integer skuId;
    private String gtRegionIdStrings;
    private String gtRegionNameStrings;
    private List<Integer> gtRegionIds;
    private List<String> gtRegionNames;
    private Integer skuSalesInformationId;
    private String productName;
    private Double regionalPrice;
    private Double proportion;
    private Double depositDeduction;
    private String remark;
    private String cycles;

    public List<Integer> getGtRegionIds() {
        if (StringUtils.isNotEmpty(this.gtRegionIdStrings)) {
            String[] split = this.gtRegionIdStrings.split(",");
            List<Integer> list = new ArrayList<>();
            for (String s : split) {
                list.add(Integer.parseInt(s));
            }
            return list;
        }
        return gtRegionIds;
    }

    public List<String> getGtRegionNames() {
        if (StringUtils.isNotEmpty(this.gtRegionNameStrings)) {
            String[] split = this.gtRegionNameStrings.split(",");
            List<String> list = new ArrayList<>();
            for (String s : split) {
                list.add(s);
            }
            return list;
        }
        return gtRegionNames;
    }
}
